<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="java.util.*,
						org.apache.commons.logging.Log, 
						org.apache.commons.logging.LogFactory,
						com.ophelisis.common.util.*,
						com.ophelisis.common.consts.*,
						com.ophelisis.common.consts.ConstCode.MenuGNB,
						com.ophelisis.actions.system.*"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="page" uri="/tld/xdp-page.tld"%>

<script>
$(document).ready(function() {
	var firstCode = $("#_prevFirstCode").val();
	if (firstCode != "") {
		pmModule.select(firstCode, "1");
	}

	var secondCode = $("#_prevSecondCode").val();
	if (secondCode != "") {
		pmModule.select(secondCode, "2");
	}
});
</script>
<!-- List Start -->
<%@ include file="/WEB-INF/jsp/common/resultMessageLocal.jsp"%>
<form id="searchForm" name="searchForm" method="post">
</form>
<div id="formtitle">
	<div id="formlist2l" class="flo_l">
		<form id="firstForm" name="firstForm" method="post">
			<input type="hidden" id="isNew" name="isNew" value="Y" />
			<input type="hidden" id="categoryId" name="categoryId" value="" />
			<input type="hidden" id="categoryType" name ="categoryType" value="1" />
			<table class="liststyle1">
				<colgroup>
					<col width="" />
				</colgroup>
				<tr>
					<th scope="col">1차 카테고리</th>
				</tr>
			</table>
			<ul id="rFirst">
				<li class="ulPlusMenu"><a href="#" class="clickable" onclick="javascript:pmModule.setAdd('1');">카테고리 추가</a></li>
				 <c:choose>
					<c:when test="${categoryList != '' && !empty categoryList}">
						<c:forEach var="fcList" items="${categoryList}" varStatus="status">
							<c:if test="${(fcList.categoryFirst == '' || empty fcList.categoryFirst) && (fcList.categorySecond == '' || empty fcList.categorySecond)}">
								<li class="ulMenu <c:if test="${fcList.categoryId == _prevFirstCode}">selected</c:if>" id="first_${fcList.categoryId}">
									<c:if test="${fcList.useYn == 'N'}">
										<div class="flo_l"><img src="images/icon/icon_02.gif" style="padding-top:2px;" />&nbsp;</div>
									</c:if>
									<div class="flo_l"><a href="#" class="clickable" onclick="javascript:pmModule.setModify('${fcList.categoryId}','${fcList.categoryNm}','${fcList.categoryDesc}','${fcList.useYn}','${fcList.categoryType}','${fcList.menuGroupId}');">${fcList.categoryNm}</a></div>
									<div class="flo_r">
										<img src="images/btn/btn_delete.gif" class="clickable" onclick="javascript:pmModule.setDelete('${fcList.categoryId}','${fcList.categoryType}');" />
										<img src="images/btn/btn_select02.gif" class="clickable" onclick="javascript:pmModule.select('${fcList.categoryId}','${fcList.categoryType}');" />
									</div>
								</li>
								<input type="hidden" id="use_${fcList.categoryId}" name="use_${fcList.categoryId}" value="${fcList.useYn}" />
							</c:if>
						</c:forEach>
					</c:when>
					<c:otherwise>
						<li class="ulMenu"></li>
					</c:otherwise>
				</c:choose>
			</ul>
			<ul id="addFirstDiv" class="bgWhite nodisplay">
				<li class="ulFormMenu">카테고리 이름 : <input type="text" id="categoryNm" name="categoryNm" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">카테고리 설명 : <input type="text" id="categoryDesc" name="categoryDesc" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">메뉴 그룹: 
					<select id="menuGroupId" name="menuGroupId" class="in3 intex_l">
						<option value="">== 그룹 선택 ==</option>
						<c:choose>
							<c:when test="${menuGroupList != '' && !empty menuGroupList}">
								<c:forEach var="mgList" items="${menuGroupList}" varStatus="status">
									<option value="${mgList.menuGroupId}">${mgList.menuGroupNm}</option>
								</c:forEach>
							</c:when>
						</c:choose>
					</select>
				</li>
				<li class="ulFormMenu">사용 여부 : <input type="radio" id="useYn1" name="useYn" value="Y" checked="checked" /> 사용 <input type="radio" id="useYn2" name="useYn" value="N" /> 미사용</li>
				<li class="ulFormMenu tex_center">
					<img src="images/btn/btn_cancel.gif" class="clickable" onclick="javascript:pmModule.cancel('1');" />&nbsp;
					<img src="images/btn/btn_save.gif" class="clickable" onclick="javascript:pmModule.save('1');" />
				</li>
			</ul>
		</form>
	</div>
	<div id="formlist2c" class="flo_l">
		<form id="secondForm" name="secondForm" method="post">
			<input type="hidden" id="isNew" name="isNew" value="Y" />
			<input type="hidden" id="categoryFirst" name="categoryFirst" value="" />
			<input type="hidden" id="categoryId" name="categoryId" value="" />
			<input type="hidden" id="categoryType" name ="categoryType" value="2" />
			<input type="hidden" id="menuGroupId" name ="menuGroupId" value="" />
			<table class="liststyle1">
				<colgroup>
					<col width="" />
				</colgroup>
				<tr>
					<th scope="col">2차 카테고리</th>
				</tr>
			</table>
			<ul id="rSecond" class="nodisplay">
				<li class="ulPlusMenu"><a href="#" class="clickable" onclick="javascript:pmModule.setAdd('2');">카테고리 추가</a></li>
				<c:choose>
					<c:when test="${categoryList != '' && !empty categoryList}">
						<c:forEach var="scList" items="${categoryList}" varStatus="status">
							<c:if test="${(scList.categoryFirst != '' && !empty scList.categoryFirst) && (scList.categorySecond == '' || empty scList.categorySecond)}">
								<li class="ulMenu first_${scList.categoryFirst} nodisplay <c:if test="${scList.categoryId == _prevSecondCode}">selected</c:if>" id="second_${scList.categoryId}">
									<c:if test="${scList.useYn == 'N'}">
										<div class="flo_l"><img src="images/icon/icon_02.gif" style="padding-top:2px;" />&nbsp;</div>
									</c:if>
									<div class="flo_l"><a href="#" class="clickable" onclick="javascript:pmModule.setModify('${scList.categoryId}','${scList.categoryNm}','${scList.categoryDesc}','${scList.useYn}','${scList.categoryType}','${scList.menuGroupId}');">${scList.categoryNm}</a></div>
									<div class="flo_r">
										<img src="images/btn/btn_delete.gif" class="clickable" onclick="javascript:pmModule.setDelete('${scList.categoryId}','${scList.categoryType}');" />
										<img src="images/btn/btn_select02.gif" class="clickable" onclick="javascript:pmModule.select('${scList.categoryId}','${scList.categoryType}');" />
									</div>
								</li>
								<input type="hidden" id="use_${scList.categoryId}" name="use_${scList.categoryId}" value="${scList.useYn}" />
							</c:if>
						</c:forEach>
					</c:when>
					<c:otherwise>
						<li class="ulMenu"></li>
					</c:otherwise>
				</c:choose>
			</ul>
			<ul id="addSecondDiv" class="bgWhite nodisplay">
				<li class="ulFormMenu">카테고리 이름 : <input type="text" id="categoryNm" name="categoryNm" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">카테고리 설명 : <input type="text" id="categoryDesc" name="categoryDesc" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">사용 여부 : <input type="radio" id="useYn1" name="useYn" value="Y" checked="checked" /> 사용 <input type="radio" id="useYn2" name="useYn" value="N" /> 미사용</li>
				<li class="ulFormMenu tex_center">
					<img src="images/btn/btn_cancel.gif" class="clickable" onclick="javascript:pmModule.cancel('2');" />&nbsp;
					<img src="images/btn/btn_save.gif" class="clickable" onclick="javascript:pmModule.save('2');" />
				</li>
			</ul>
		</form>
	</div>
	<div id="formlist2r" class="flo_l">
		<form id="thirdForm" name="thirdForm" method="post">
			<input type="hidden" id="isNew" name="isNew" value="Y" />
			<input type="hidden" id="categoryFirst" name="categoryFirst" value="" />
			<input type="hidden" id="categorySecond" name="categorySecond" value="" />
			<input type="hidden" id="categoryId" name="categoryId" value="" />
			<input type="hidden" id="categoryType" name ="categoryType" value="3" />
			<input type="hidden" id="menuGroupId" name ="menuGroupId" value="" />
			<table class="liststyle1">
				<colgroup>
					<col width="" />
				</colgroup>
				<tr>
					<th scope="col">3차 카테고리</th>
				</tr>
			</table>
			<ul id="rThird" class="nodisplay">
				<li class="ulPlusMenu"><a href="#" class="clickable" onclick="javascript:pmModule.setAdd('3');">카테고리 추가</a></li>
				<c:choose>
					<c:when test="${categoryList != '' && !empty categoryList}">
						<c:forEach var="tcList" items="${categoryList}" varStatus="status">
							<li class="ulMenu second_${tcList.categorySecond} nodisplay <c:if test="${tcList.categoryId == _prevThirdCode}">selected</c:if>" id="third_${tcList.categoryId}">
								<c:if test="${tcList.useYn == 'N'}">
									<div class="flo_l"><img src="images/icon/icon_02.gif" style="padding-top:2px;" />&nbsp;</div>
								</c:if>
								<div class="flo_l"><a href="#" class="clickable" onclick="javascript:pmModule.setModify('${tcList.categoryId}','${tcList.categoryNm}','${tcList.categoryDesc}','${tcList.useYn}','${tcList.categoryType}','${tcList.menuGroupId}');">${tcList.categoryNm}</a></div>
								<div class="flo_r">
									<img src="images/btn/btn_delete.gif" class="clickable" onclick="javascript:pmModule.setDelete('${tcList.categoryId}','${tcList.categoryType}');" />
								</div>
							</li>
							<input type="hidden" id="use_${tcList.categoryId}" name="use_${tcList.categoryId}" value="${tcList.useYn}" />
						</c:forEach>
					</c:when>
					<c:otherwise>
						<li class="ulMenu"></li>
					</c:otherwise>
				</c:choose>
			</ul>
			<ul id="addThirdDiv" class="bgWhite nodisplay">
				<li class="ulFormMenu">카테고리 이름 : <input type="text" id="categoryNm" name="categoryNm" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">카테고리 설명 : <input type="text" id="categoryDesc" name="categoryDesc" class="in3 intex_l width_50c" value="" /></li>
				<li class="ulFormMenu">사용 여부 : <input type="radio" id="useYn1" name="useYn" value="Y" checked="checked" /> 사용 <input type="radio" id="useYn2" name="useYn" value="N" /> 미사용</li>
				<li class="ulFormMenu tex_center">
					<img src="images/btn/btn_cancel.gif" class="clickable" onclick="javascript:pmModule.cancel('3');" />&nbsp;
					<img src="images/btn/btn_save.gif" class="clickable" onclick="javascript:pmModule.save('3');" />
				</li>
			</ul>
		</form>
	</div>
</div>
<!-- List End -->
